/**
* @author Lasharn Weerasinghe, and Matt
*/
import java.io.*;
import java.util.*;
public class GuessNumber {
	
	public static void main(String[] args) throws IOException {
		Random random = new Random();
		int number = random.nextInt(100);
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String line;
		System.out.println("Guess the number: ");
		while ((line = reader.readLine()) != null) {

			try {
				int guess = Integer.parseInt(line);
				if (guess == number) {
					System.out.println("You guessed correctly!");
					return;
				} else if (guess > number) {
					System.out.println("Your guess was high.");
				} else {
					System.out.println("Your guess was low.");
				}
				System.out.println("Guess the number: ");
				
			} catch (Exception e) {
				System.out.println("\"" + line + "\" is not a number.");
				System.out.println("Guess the number: ");
			}
		}
	}
}
